package com.zhao.dota.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zhao.dota.mapper.UserGoldMapper;
import com.zhao.dota.model.UserGold;
import com.zhao.dota.service.UserGoldService;
import com.zhao.dota.vo.UserAchievementVo;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserGoldServiceImpl extends ServiceImpl<UserGoldMapper, UserGold> implements UserGoldService {

    @Override
    public UserGold getByLeagueIdUserId(Integer leagueId, Integer userId) {
        LambdaQueryWrapper<UserGold> query = Wrappers.lambdaQuery(UserGold.class)
                .eq(UserGold::getLeagueId, leagueId)
                .eq(UserGold::getUserId, userId);
        return getOne(query);
    }

    @Override
    public List<UserAchievementVo> userGold(Integer leagueId) {
        return baseMapper.userGold(leagueId);
    }
}
